package logic

import (
	"context"
	"renting-demo/model/mysql"

	"renting-demo/house_srv/house"
	"renting-demo/house_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListLogic {
	return &ListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ListLogic) List(in *house.ListRequest) (*house.Response, error) {
	// todo: add your logic here and delete this line
	re := mysql.HouseList(int(in.Page), in.Search)
	if re == nil {
		return &house.Response{
			Status: "0",
		}, nil
	}
	return &house.Response{
		Status: "1",
	}, nil
}
